home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 099 (1989-05-15)(Ossowski, Stefan)(DE)(PD).zip / Taifun 099 (1989-05-15)(Ossowski, Stefan)(DE)(PD).adf / PCQ / Runtime / readarb.asm < prev    next >
Assembly Source File  |  1989-03-31  |  1KB  |  44 lines

  1.  
  2. *    ReadArb.asm (of PCQ Pascal runtime library)
  3. *    Copyright (c) 1989 Patrick Quaid
  4.  
  5. *    This just implements reading some data element into the
  6. *    file buffer.  This is what is used for reading an integer from a
  7. *    file of integer, for example, rather than a text file.  Of course
  8. *    it can be used for any sort of data element.
  9.  
  10.     SECTION    ONE
  11.  
  12.     XREF    _p%readarbbuf
  13.  
  14.     XDEF    _p%readarb
  15. _p%readarb
  16.     move.l    a0,a1            ; shift var address over
  17.     move.l    4(sp),a0        ; get address of file record
  18.     tst.b    12(a0)            ; are we at eof?
  19.     bne    6$            ; if so, skip this stuff
  20.     move.l    8(a0),d1        ; get buffer size
  21.     cmp.l    #1,d1            ; is it 1?
  22.     bne.s    1$            ; if not, go around
  23.     move.b    4(a0),d0        ; get the byte
  24.     move.b    d0,(a1)            ; and save it
  25.     bra.s    5$            ; and go
  26. 1$    cmp.l    #2,d1            ; is it 2?
  27.     bne.s    2$            ; if not, split
  28.     move.w    4(a0),d0        ; get word
  29.     move.w    d0,(a1)            ; save it
  30.     bra.s    5$            ; and go
  31. 2$    cmp.l    #4,d1            ; is it 4?
  32.     bne.s    3$            ; if not, skip ahead
  33.     move.l    4(a0),d0        ; get word
  34.     move.l    d0,(a1)            ; save it
  35.     bra.s    5$            ; and leave
  36. 3$    move.l    4(a0),a2        ; get the buffer address
  37. 4$    move.b    (a2)+,d0        ; get a byte
  38.     move.b    d0,(a1)+        ; and store it
  39.     dbra    d1,4$            ; and loop
  40. 5$    jsr    _p%readarbbuf        ; get next item
  41. 6$    rts
  42.  
  43.     END
  44.